var FMFPdxfParserEntititiesText = Class.create();
FMFPdxfParserEntititiesText.prototype = {
    initialize: function () {
		this.helpers = new FMFPParseHelpers();
    },

    ForEntityName: 'TEXT',

    parseEntity: function (scanner, curr) {
		var self = this;
        var entity;
        entity = { type: curr.value };
        curr = scanner.next();
        while (curr !== 'EOF') {
            if (curr.code === 0) break;
            switch (curr.code) {
                case 7 :
                    entity.textStyle = curr.value;
                    break;
                case 10: // X coordinate of 'first alignment point'
                    entity.startPoint = self.helpers.parsePoint(scanner);
                    break;
                case 11: // X coordinate of 'second alignment point'
                    entity.endPoint = self.helpers.parsePoint(scanner);
                    break;
                case 40: // Text height
                    entity.textHeight = curr.value;
                    break;
                case 41:
                    entity.xScale = curr.value;
                    break;
                case 50: // Rotation in degrees
                    entity.rotation = curr.value;
                    break;
                case 1: // Text
                    entity.text = curr.value;
                    break;
                // NOTE: 72 and 73 are meaningless without 11 (second alignment point)
                case 72: // Horizontal alignment
                    entity.halign = curr.value;
                    break;
                case 73: // Vertical alignment
                    entity.valign = curr.value;
                    break;
                default: // check common entity attributes
                    self.helpers.checkCommonEntityProperties(entity, curr);
                    break;
            }
            curr = scanner.next();
        }
        return entity;
    },
    
    type: 'FMFPdxfParserEntititiesText'
};